package Demo;

 class Animal {
    private String name;
    private int age;
    int c;

    public Animal() {
        System.out.println("父类构造方法");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}

class Cat extends Animal{
    public String hair;

    public Cat(String name,int age) {
        this.hair = "yellow";
        System.out.println("Cat的构造方法");
    }
    public void eat() {
        System.out.println(getAge()+"岁的"+getName()+"正在吃饭");
    }
}

public class Test {
    public static void main(String[] args) {
        Cat cat = new Cat("mimi",18);
        cat.eat();
    }

   /* public static void main1(String[] args) {
        Cat cat = new Cat();
        cat.setAge(2);
        cat.setName("咪咪");
        cat.eat();
    }*/
}
